package cn.edu.scau.cmi.heyonglin.adapter;

import java.util.ArrayList;
import java.util.List;

public class AdapterOfClass  extends SortUtil implements Target{
	@Override
	public void doTarget(Student[] student,int n) {
		List<Integer> intList = new ArrayList<>();
		Student temp=null;
		for(int i=0;i<n;i++) { 
			int schoolid=student[i].getSchoolId();
			intList.add(schoolid);
		}
		intList=sortInt(intList,n);
		for(int i=0;i<n-1;i++) {
			for(int j=i;j<n;j++) {
				int schoolid=student[j].getSchoolId();
				if(intList.get(i)==schoolid) {
					temp=student[i];
					student[i]=student[j];
					student[j]=temp;
				}
			}
		}
		for(int i=0;i<n;i++) {
			String name=student[i].getName();
			int id=student[i].getSchoolId();
			System.out.println(id+"  "+name);
		}
		System.out.println();
	}
}
